using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraManager : MonoBehaviour
{
    private static CameraManager instance;

    public static CameraManager Instance
    {
        get
        {
            return instance;
        }
    }

    public void Awake()
    {
        instance = this;
    }

    /// <summary>
    /// 初始化与角色坐标对应
    /// </summary>
    public void InitWithPlayer()
    {
        UpdateCameraPos();
    }

    private void LateUpdate()
    {
        UpdateCameraPos();
    }

    private void UpdateCameraPos()
    {
        if (PlayerLogicModule.Instnace == null || PlayerLogicModule.Instnace.PlayerController == null)
            return;

        Vector3 pos = PlayerLogicModule.Instnace.PlayerController.transform.position;
        transform.position = new Vector3(pos.x, pos.y, -10);

    }
}
